package de.koller.worlders.engine.entity.mo.wphysics;

import de.koller.worlders.engine.entity.mo.MovingObject;

public class WVelocity {

//	public static final double CLAMP_WAY = 1;
	
	public void updateVelocity( MovingObject mo, int elapsedTime ) {
		mo.getEnergy().add( mo.getForce().getX() * elapsedTime, mo.getForce().getY() * elapsedTime );
	}
	
	public void updateWishedWay( MovingObject mo, int elapsedTime ) {
		mo.wpTransferObj.getWishWay().set( 
				( mo.getVelocity().getX() + mo.getEnergy().getX() ) * elapsedTime, 
				( mo.getVelocity().getY() + mo.getEnergy().getY() ) * elapsedTime );
		//clampWay( mo.wpTransferObj.getWishWay() );
	}
	
//	private void clampWay( Vec deltaWay ) {
//		boolean clamped = false;
//		
//		if( Math.abs( deltaWay.getX() ) > CLAMP_WAY ) {
//			deltaWay.setX( deltaWay.getX() > 0 ? CLAMP_WAY : -CLAMP_WAY );
//			clamped = true;
//		}
//		
//		if( Math.abs( deltaWay.getY() ) > CLAMP_WAY ) {
//			deltaWay.setY( deltaWay.getY() > 0 ? CLAMP_WAY : -CLAMP_WAY );
//			clamped = true;
//		}
//	}
	
}
